<template>
  <div id="repassword" class="repassword">
    <yd-navbar slot="navbar" fixed>
      <a @click="$router.go(-1)" slot="left">
        <yd-navbar-back-icon></yd-navbar-back-icon>
      </a>
      <span slot="center" style="font-size:18px">重置密码</span>
    </yd-navbar>

    <div class="content-repassword" fixed>
      <div class="space-10"></div>

            <yd-cell-item>
              <span slot="left">旧密码：</span>
              <yd-input slot="right" required v-model.trim="passwordOld" max="20" placeholder="请输入旧密码"></yd-input>
            </yd-cell-item>
            <yd-cell-item>
              <span slot="left">新密码：</span>
              <yd-input slot="right" v-model.trim="passwordNew" placeholder="请输入新密码"></yd-input>
            </yd-cell-item>
            <!--      -->
            <yd-button size="large" bgcolor="#2196f3" color="#fff" @click.native="resetPassword">重置密码</yd-button>


    </div>

  </div>
</template>

<script>
  import axios from '../../axios'
  import baseService from '../../axios/'

  export default {
    name: 'repassword',
    data() {
      return {
        msg: '',
        passwordOld: '',
        passwordNew: ''
      }
    },
    methods: {
      resetPassword: function () {
        let param = new URLSearchParams();
        let passwordOld = this.passwordOld;
        let passwordNew = this.passwordNew;
        param.append("passwordOld", passwordOld);
        param.append("passwordNew", passwordNew);
        baseService.post('/user/resetPassword.do', param).then((res) => {
          this.$dialog.alert({
            mes: res.data.msg
          });
        })
      }
    }
  }

</script>

<style>
  .repassword .content-repassword {
    background-color:#FCFCFC !important;
    height: 100%;
    position: fixed;
    width: 100%;
    ;
    padding-top: 13%;


  }

</style>
